package com.zhuss.core.part;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.zhuss.bean.bo.core.part.CreatePartBo;
import com.zhuss.bean.bo.core.part.DeletePartBo;
import com.zhuss.bean.bo.core.part.UpdatePartBo;
import com.zhuss.common.OperateService;
import com.zhuss.common.Processor;
import com.zhuss.exception.WpsException;

/**
 * 区域操作service（基本操作）
 * @author zhushanshuo
 * @Date 2020-02-05 15:59
 *
 */
@Component("partOperateService")
public class PartOperateService implements OperateService<Void, Object> {
	
	@Autowired
	@Qualifier("partCreate")
	private Processor<Object, CreatePartBo> partCreate;
	
	@Autowired
	@Qualifier("partUpdate")
	private Processor<Object, UpdatePartBo> partUpdate;
	
	@Autowired
	@Qualifier("partDelete")
	private Processor<Object, DeletePartBo> partDelete;
	
	/**
	 * 创建
	 */
	@Override
    @Transactional(rollbackFor = Exception.class)
	public Void create(Object param) throws WpsException {
		
		CreatePartBo bo = (CreatePartBo) param;
		
		partCreate.process(bo);
		
		return null;
	}
    
	/**
	 * 修改
	 */
	@Override
    @Transactional(rollbackFor = Exception.class)
    public Void update(Object param) throws WpsException {
    	
		UpdatePartBo bo = (UpdatePartBo) param;
		
		partUpdate.process(bo);
		
    	return null;
    }
	
	/**
	 * 删除
	 */
	@Override
	@Transactional(rollbackFor = Exception.class)
	public Void delete(Object param) throws WpsException {
		
		DeletePartBo bo = (DeletePartBo) param;
		
		partDelete.process(bo);
		
		return null;
	}
	
	
}

